package qunartest02;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;

import java.util.*;

public class CompareJson {

    private static final String SysRoot = "sys_root";
    private static final String SysType = "sys_type";
    private static final String SysObj = "sys_obj";
    private static final String SysNew = "sys_new";
    private static final String SysOld = "sys_old";
    private static final String TypeNew = "new";
    private static final String TypeDelete = "delete";
    private static final String TypeDifference = "difference";

    private String itemKey;
    private List<String> ignoreKeys = new ArrayList<>();

    public CompareJson(String itemKey) {
        this.itemKey = itemKey;
    }

    public CompareJson(String itemKey, String ignoreKeys) {
        this.itemKey = itemKey;
        this.ignoreKeys = Arrays.asList(ignoreKeys.split("\\,"));
    }

    public static void main(String[] args) {
        final String json1 = "{\n" +
                "    \"defaultPhone\":null,\n" +
                "    \"appLimit\":false,\n" +
                "    \"productDisplayFlag\":0,\n" +
                "    \"noContactName\":false,\n" +
                "    \"noContactPhone\":false,\n" +
                "    \"contactNameDesc\":\"\",\n" +
                "    \"contactPhoneDesc\":\"\",\n" +
                "    \"idCardDesc\":\"\",\n" +
                "    \"needExpress\":true,\n" +
                "    \"coverExpress\":true,\n" +
                "    \"expressPrice\":0,\n" +
                "    \"expressPriceList\":[\n" +
                "\n" +
                "    ],\n" +
                "    \"totalPrice\":94.9,\n" +
                "    \"disCountPrice\":2,\n" +
                "    \"pointPrice\":33.9,\n" +
                "    \"pointPriceAmountPoint\":20,\n" +
                "    \"redemptionProductVOList\":[\n" +
                "        {\n" +
                "            \"linePrice\":9.9,\n" +
                "            \"salePrice\":6.5,\n" +
                "            \"name\":\"吉凯林点断式垃圾袋5卷100个\",\n" +
                "            \"productDesc\":\"高强度 点断式 易撕取\",\n" +
                "            \"isometricPicture\":\"https://f-flight-akihabaracp.qunarzz.com/f_flight_akihabara_f_flight_akihabara/awb1lkPZPKN2QVqCaWbR.jpg\",\n" +
                "            \"saveMoney\":3.4,\n" +
                "            \"discount\":6.6,\n" +
                "            \"pid\":\"000448075747\",\n" +
                "            \"productToken\":\".jcXopznyZ1JcF9erqrp8k40wIbjC0FjpWoMeB1k7.bE169JuMmDthhLHvkG9W4I1FpqbEQ0OE7Ze.WkAq7Dd7bAglNVhh0Se1Q4P586knlvJUrWiAnxbmACP9MO97zlugiUTnwDrXQiOhZ749pGHw--\",\n" +
                "            \"receiveAddressBlackList\":\"[{\\\"province\\\":{\\\"name\\\":\\\"新疆维吾尔自治区\\\",\\\"code\\\":\\\"650000\\\"},\\\"city\\\":{\\\"name\\\":\\\"\\\",\\\"code\\\":\\\"\\\"},\\\"district\\\":{\\\"name\\\":\\\"\\\",\\\"code\\\":\\\"\\\"}},{\\\"province\\\":{\\\"name\\\":\\\"西藏自治区\\\",\\\"code\\\":\\\"540000\\\"},\\\"city\\\":{\\\"name\\\":\\\"\\\",\\\"code\\\":\\\"\\\"},\\\"district\\\":{\\\"name\\\":\\\"\\\",\\\"code\\\":\\\"\\\"}}]\"\n" +
                "        }\n" +
                "    ],\n" +
                "    \"deductInfos\":[\n" +
                "        {\n" +
                "            \"deductType\":1,\n" +
                "            \"actualDeductAmount\":2,\n" +
                "            \"desc\":\"可用20积分抵¥2.00\",\n" +
                "            \"select\":true,\n" +
                "            \"canUsePoint\":true,\n" +
                "            \"userPoint\":9325,\n" +
                "            \"userPointAmount\":932.5,\n" +
                "            \"pointShowStyle\":1,\n" +
                "            \"salePrice\":35.9,\n" +
                "            \"pointPrice\":33.9,\n" +
                "            \"pointPriceDeductPoint\":20,\n" +
                "            \"actualPointPrice\":33.9,\n" +
                "            \"actualPointPriceDeductPoint\":20,\n" +
                "            \"userId\":0,\n" +
                "            \"transactionId\":null\n" +
                "        }\n" +
                "    ],\n" +
                "    \"deliveryTimeDesc\":\"48小时发货\",\n" +
                "    \"bookingTag\":\"8c68adc4a63319c7d302fc26a6d5f77a\",\n" +
                "    \"productToken\":\"MIklLB0zYcVJHrtn7BnLSMo7GH4OS3wtt7QK0nOeew.5dlWrk6.SxN.tCqXUUM1iIDi7g14dfJ4xaWqe0mOY19fRqiiF5p3B9RHASGu_P_3SZ5sMKWfQhONjWiAsi2qacqbC28dOI0j4vxrnD.6UuBENOCRRzkSWPBEbFO_mfYY-\",\n" +
                "    \"salePrice\":94.9,\n" +
                "    \"activityProductList\":null,\n" +
                "    \"reduceActivityInfo\":null,\n" +
                "    \"yellowNoteTipDesc\":\"\",\n" +
                "    \"cancelDefaultFillIn\":false,\n" +
                "    \"hideAddressBook\":false,\n" +
//                "    \"pid\":\"001476916785\",\n" +
                "    \"productType\":43505075,\n" +
                "    \"saleSinglePrice\":null,\n" +
                "    \"needPassPort\":false,\n" +
                "    \"needTravelInfo\":false,\n" +
                "    \"changePriceText\":null,\n" +
                "    \"relateOrderNo\":\"\",\n" +
                "    \"needIdCard\":false,\n" +
                "    \"userAuthInfo\":null,\n" +
                "    \"needGoneHotelAddress\":false,\n" +
                "    \"needUseDate\":false,\n" +
                "    \"needReturnHotelAddress\":false,\n" +
                "    \"needCardPhoto\":false,\n" +
                "    \"showAgreement\":false,\n" +
                "    \"declareWords\":null,\n" +
                "    \"userAgreemane\":null,\n" +
                "    \"needPassengerPhone\":false,\n" +
                "    \"multiPsgInfo\":false,\n" +
                "    \"productItems\":[\n" +
                "        {\n" +
                "            \"picUrl\":\"https://f-flight-akihabaracp.qunarzz.com/f_flight_akihabara_f_flight_akihabara/4RT8j1lqCkpaxEr2mT5r.jpg\",\n" +
                "            \"name\":\"上新了故宫 紫禁城3D立体拼图太和殿【淘宝价格78，限时优惠价59】\",\n" +
                "            \"productDesc\":\"淘宝78元，限时优惠价59元\",\n" +
                "            \"buyNum\":1,\n" +
                "            \"productPrice\":59,\n" +
                "            \"depTrip\":null,\n" +
                "            \"returnTip\":null,\n" +
                "            \"relateName\":\"太和殿\",\n" +
                "            \"bookingProductText\":\"安心购\",\n" +
                "            \"pointShowStyle\":0,\n" +
                "            \"pointDeduct\":null,\n" +
                "            \"pointPrice\":null,\n" +
                "            \"pointPriceDeductPoint\":null,\n" +
                "            \"receiveAddressBlackList\":\"\",\n" +
                "            \"isShowPrice\":true\n" +
                "        },\n" +
                "        {\n" +
                "            \"picUrl\":\"https://f-flight-akihabaracp.qunarzz.com/f_flight_akihabara_f_flight_akihabara/bfhW4h7diPf1BuSandXN.jpg\",\n" +
                "            \"name\":\"电动双面清洁洗脸仪 浅蓝 VC19402G044BU101\",\n" +
                "            \"productDesc\":\"男女超声波去黑头神器\",\n" +
                "            \"buyNum\":1,\n" +
                "            \"productPrice\":35.9,\n" +
                "            \"depTrip\":null,\n" +
                "            \"returnTip\":null,\n" +
                "            \"relateName\":\"浅蓝（带底座）\",\n" +
                "            \"bookingProductText\":\"安心购\",\n" +
                "            \"pointShowStyle\":1,\n" +
                "            \"pointDeduct\":2,\n" +
                "            \"pointPrice\":33.9,\n" +
                "            \"pointPriceDeductPoint\":20,\n" +
                "            \"receiveAddressBlackList\":\"\",\n" +
                "            \"isShowPrice\":true\n" +
                "        }\n" +
                "    ],\n" +
                "    \"cardTypeList\":null,\n" +
                "    \"productSpecifications\":null,\n" +
                "    \"needEmail\":false,\n" +
                "    \"needAcceptAgreement\":false,\n" +
                "    \"tradeAgreementUrl\":null,\n" +
                "    \"needNotes\":false,\n" +
                "    \"priceItems\":[\n" +
                "        {\n" +
                "            \"key\":\"productPrice\",\n" +
                "            \"showName\":\"商品价格\",\n" +
                "            \"operation\":false,\n" +
                "            \"value\":94.9,\n" +
                "            \"mark\":false,\n" +
                "            \"deductType\":0,\n" +
                "            \"showRmbMark\":true,\n" +
                "            \"highLight\":false\n" +
                "        },\n" +
                "        {\n" +
                "            \"key\":\"expressPrice\",\n" +
                "            \"showName\":\"运费\",\n" +
                "            \"operation\":false,\n" +
                "            \"value\":0,\n" +
                "            \"mark\":false,\n" +
                "            \"deductType\":0,\n" +
                "            \"showRmbMark\":true,\n" +
                "            \"highLight\":false\n" +
                "        },\n" +
                "        {\n" +
                "            \"key\":\"pointDeduct\",\n" +
                "            \"showName\":\"积分抵扣\",\n" +
                "            \"operation\":false,\n" +
                "            \"value\":2,\n" +
                "            \"mark\":true,\n" +
                "            \"deductType\":1,\n" +
                "            \"showRmbMark\":true,\n" +
                "            \"highLight\":false\n" +
                "        }\n" +
                "    ],\n" +
                "    \"productInfos\":[\n" +
                "        {\n" +
                "            \"pid\":\"000726682281\",\n" +
                "            \"productType\":43505075,\n" +
                "            \"productItems\":[\n" +
                "                {\n" +
                "                    \"picUrl\":\"https://f-flight-akihabaracp.qunarzz.com/f_flight_akihabara_f_flight_akihabara/4RT8j1lqCkpaxEr2mT5r.jpg\",\n" +
                "                    \"name\":\"上新了故宫 紫禁城3D立体拼图太和殿【淘宝价格78，限时优惠价59】\",\n" +
                "                    \"productDesc\":\"淘宝78元，限时优惠价59元\",\n" +
                "                    \"buyNum\":1,\n" +
                "                    \"productPrice\":59,\n" +
                "                    \"depTrip\":null,\n" +
                "                    \"returnTip\":null,\n" +
                "                    \"relateName\":\"太和殿\",\n" +
                "                    \"bookingProductText\":\"安心购\",\n" +
                "                    \"pointShowStyle\":0,\n" +
                "                    \"pointDeduct\":null,\n" +
                "                    \"pointPrice\":null,\n" +
                "                    \"pointPriceDeductPoint\":null,\n" +
                "                    \"receiveAddressBlackList\":\"\",\n" +
                "                    \"isShowPrice\":true\n" +
                "                }\n" +
                "            ],\n" +
                "            \"buyNum\":1\n" +
                "        },\n" +
                "        {\n" +
                "            \"pid\":\"001476916785\",\n" +
                "            \"productType\":43505075,\n" +
                "            \"productItems\":[\n" +
                "                {\n" +
                "                    \"picUrl\":\"https://f-flight-akihabaracp.qunarzz.com/f_flight_akihabara_f_flight_akihabara/bfhW4h7diPf1BuSandXN.jpg\",\n" +
                "                    \"name\":\"电动双面清洁洗脸仪 浅蓝 VC19402G044BU101\",\n" +
                "                    \"productDesc\":\"男女超声波去黑头神器\",\n" +
                "                    \"buyNum\":1,\n" +
                "                    \"productPrice\":35.9,\n" +
                "                    \"depTrip\":null,\n" +
                "                    \"returnTip\":null,\n" +
                "                    \"relateName\":\"浅蓝（带底座）\",\n" +
                "                    \"bookingProductText\":\"安心购\",\n" +
                "                    \"pointShowStyle\":1,\n" +
                "                    \"pointDeduct\":2,\n" +
                "                    \"pointPrice\":33.9,\n" +
                "                    \"pointPriceDeductPoint\":20,\n" +
                "                    \"receiveAddressBlackList\":\"\",\n" +
                "                    \"isShowPrice\":true\n" +
                "                }\n" +
                "            ],\n" +
                "            \"buyNum\":1\n" +
                "        }\n" +
                "    ],\n" +
                "    \"originPrice\":null,\n" +
                "    \"memberDiscount\":0,\n" +
                "    \"packageDiscount\":0,\n" +
                "    \"baseDeductInfoContext\":null,\n" +
                "    \"serviceTitle\":null,\n" +
                "    \"serviceAddress\":null,\n" +
                "    \"receivedMask\":null,\n" +
                "    \"ownerPanelInfo\":null,\n" +
                "    \"seatInfo\":null,\n" +
                "    \"daMaiToken\":null,\n" +
                "    \"package\":false,\n" +
                "    \"rechargeProductType\":false,\n" +
                "    \"combine\":true,\n" +
                "    \"needRealNameAuth\":false,\n" +
                "    \"restrainPersionalUse\":false\n" +
                "}";
        final String json2 = "{\n" +
                "    \"defaultPhone\":null,\n" +
                "    \"appLimit\":false,\n" +
                "    \"productDisplayFlag\":0,\n" +
                "    \"noContactName\":false,\n" +
                "    \"noContactPhone\":false,\n" +
                "    \"contactNameDesc\":\"\",\n" +
                "    \"contactPhoneDesc\":\"\",\n" +
                "    \"idCardDesc\":\"\",\n" +
                "    \"needExpress\":true,\n" +
                "    \"coverExpress\":true,\n" +
                "    \"expressPrice\":0,\n" +
                "    \"expressPriceList\":[\n" +
                "\n" +
                "    ],\n" +
                "    \"totalPrice\":94.9,\n" +
                "    \"disCountPrice\":2,\n" +
                "    \"pointPrice\":33.9,\n" +
                "    \"pointPriceAmountPoint\":20,\n" +
                "    \"redemptionProductVOList\":[\n" +
                "        {\n" +
                "            \"linePrice\":9.9,\n" +
                "            \"salePrice\":6.5,\n" +
                "            \"name\":\"吉凯林点断式垃圾袋5卷100个\",\n" +
                "            \"productDesc\":\"高强度 点断式 易撕取\",\n" +
                "            \"isometricPicture\":\"https://f-flight-akihabaracp.qunarzz.com/f_flight_akihabara_f_flight_akihabara/awb1lkPZPKN2QVqCaWbR.jpg\",\n" +
                "            \"saveMoney\":3.4,\n" +
                "            \"discount\":6.6,\n" +
                "            \"pid\":\"000448075747\",\n" +
                "            \"productToken\":\".jcXopznyZ1JcF9erqrp8k40wIbjC0FjpWoMeB1k7.bE169JuMmDthhLHvkG9W4I1FpqbEQ0OE7Ze.WkAq7Dd7bAglNVhh0Se1Q4P586knlvJUrWiAnxbmACP9MO97zlugiUTnwDrXQiOhZ749pGHw--\",\n" +
                "            \"receiveAddressBlackList\":\"[{\\\"province\\\":{\\\"name\\\":\\\"新疆维吾尔自治区\\\",\\\"code\\\":\\\"650000\\\"},\\\"city\\\":{\\\"name\\\":\\\"\\\",\\\"code\\\":\\\"\\\"},\\\"district\\\":{\\\"name\\\":\\\"\\\",\\\"code\\\":\\\"\\\"}},{\\\"province\\\":{\\\"name\\\":\\\"西藏自治区\\\",\\\"code\\\":\\\"540000\\\"},\\\"city\\\":{\\\"name\\\":\\\"\\\",\\\"code\\\":\\\"\\\"},\\\"district\\\":{\\\"name\\\":\\\"\\\",\\\"code\\\":\\\"\\\"}}]\"\n" +
                "        }\n" +
                "    ],\n" +
                "    \"deductInfos\":[\n" +
                "        {\n" +
                "            \"deductType\":1,\n" +
                "            \"actualDeductAmount\":2,\n" +
                "            \"desc\":\"可用20积分抵¥2.00\",\n" +
                "            \"select\":true,\n" +
                "            \"canUsePoint\":true,\n" +
                "            \"userPoint\":9325,\n" +
                "            \"userPointAmount\":932.5,\n" +
                "            \"pointShowStyle\":1,\n" +
                "            \"salePrice\":35.9,\n" +
                "            \"pointPrice\":33.9,\n" +
                "            \"pointPriceDeductPoint\":20,\n" +
                "            \"actualPointPrice\":33.9,\n" +
                "            \"actualPointPriceDeductPoint\":20,\n" +
                "            \"userId\":0,\n" +
                "            \"transactionId\":null\n" +
                "        }\n" +
                "    ],\n" +
                "    \"deliveryTimeDesc\":\"48小时发货\",\n" +
                "    \"bookingTag\":\"8c68adc4a63319c7d302fc26a6d5f77a\",\n" +
                "    \"productToken\":\"MIklLB0zYcVJHrtn7BnLSMo7GH4OS3wtt7QK0nOeew.5dlWrk6.SxN.tCqXUUM1iIDi7g14dfJ4xaWqe0mOY19fRqiiF5p3B9RHASGu_P_3SZ5sMKWfQhONjWiAsi2qacqbC28dOI0j4vxrnD.6UuBENOCRRzkSWPBEbFO_mfYY-\",\n" +
                "    \"salePrice\":94.9,\n" +
                "    \"activityProductList\":null,\n" +
                "    \"reduceActivityInfo\":null,\n" +
                "    \"yellowNoteTipDesc\":\"\",\n" +
                "    \"cancelDefaultFillIn\":false,\n" +
                "    \"hideAddressBook\":false,\n" +
//                "    \"pid\":\"000726682281\",\n" +
                "    \"productType\":43505075,\n" +
                "    \"saleSinglePrice\":null,\n" +
                "    \"needPassPort\":false,\n" +
                "    \"needTravelInfo\":false,\n" +
                "    \"changePriceText\":null,\n" +
                "    \"relateOrderNo\":\"\",\n" +
                "    \"needIdCard\":false,\n" +
                "    \"userAuthInfo\":null,\n" +
                "    \"needGoneHotelAddress\":false,\n" +
                "    \"needUseDate\":false,\n" +
                "    \"needReturnHotelAddress\":false,\n" +
                "    \"needCardPhoto\":false,\n" +
                "    \"showAgreement\":false,\n" +
                "    \"declareWords\":null,\n" +
                "    \"userAgreemane\":null,\n" +
                "    \"needPassengerPhone\":false,\n" +
                "    \"multiPsgInfo\":false,\n" +
                "    \"productItems\":[\n" +
                "        {\n" +
                "            \"picUrl\":\"https://f-flight-akihabaracp.qunarzz.com/f_flight_akihabara_f_flight_akihabara/bfhW4h7diPf1BuSandXN.jpg\",\n" +
                "            \"name\":\"电动双面清洁洗脸仪 浅蓝 VC19402G044BU101\",\n" +
                "            \"productDesc\":\"男女超声波去黑头神器\",\n" +
                "            \"buyNum\":1,\n" +
                "            \"productPrice\":35.9,\n" +
                "            \"depTrip\":null,\n" +
                "            \"returnTip\":null,\n" +
                "            \"relateName\":\"浅蓝（带底座）\",\n" +
                "            \"bookingProductText\":\"安心购\",\n" +
                "            \"pointShowStyle\":1,\n" +
                "            \"pointDeduct\":2,\n" +
                "            \"pointPrice\":33.9,\n" +
                "            \"pointPriceDeductPoint\":20,\n" +
                "            \"receiveAddressBlackList\":\"\",\n" +
                "            \"isShowPrice\":true\n" +
                "        },\n" +
                "        {\n" +
                "            \"picUrl\":\"https://f-flight-akihabaracp.qunarzz.com/f_flight_akihabara_f_flight_akihabara/4RT8j1lqCkpaxEr2mT5r.jpg\",\n" +
                "            \"name\":\"上新了故宫 紫禁城3D立体拼图太和殿【淘宝价格78，限时优惠价59】\",\n" +
                "            \"productDesc\":\"淘宝78元，限时优惠价59元\",\n" +
                "            \"buyNum\":1,\n" +
                "            \"productPrice\":59,\n" +
                "            \"depTrip\":null,\n" +
                "            \"returnTip\":null,\n" +
                "            \"relateName\":\"太和殿\",\n" +
                "            \"bookingProductText\":\"安心购\",\n" +
                "            \"pointShowStyle\":0,\n" +
                "            \"pointDeduct\":null,\n" +
                "            \"pointPrice\":null,\n" +
                "            \"pointPriceDeductPoint\":null,\n" +
                "            \"receiveAddressBlackList\":\"\",\n" +
                "            \"isShowPrice\":true\n" +
                "        }\n" +
                "    ],\n" +
                "    \"cardTypeList\":null,\n" +
                "    \"productSpecifications\":null,\n" +
                "    \"needEmail\":false,\n" +
                "    \"needAcceptAgreement\":false,\n" +
                "    \"tradeAgreementUrl\":null,\n" +
                "    \"needNotes\":false,\n" +
                "    \"priceItems\":[\n" +
                "        {\n" +
                "            \"key\":\"productPrice\",\n" +
                "            \"showName\":\"商品价格\",\n" +
                "            \"operation\":false,\n" +
                "            \"value\":94.9,\n" +
                "            \"mark\":false,\n" +
                "            \"deductType\":0,\n" +
                "            \"showRmbMark\":true,\n" +
                "            \"highLight\":false\n" +
                "        },\n" +
                "        {\n" +
                "            \"key\":\"expressPrice\",\n" +
                "            \"showName\":\"运费\",\n" +
                "            \"operation\":false,\n" +
                "            \"value\":0,\n" +
                "            \"mark\":false,\n" +
                "            \"deductType\":0,\n" +
                "            \"showRmbMark\":true,\n" +
                "            \"highLight\":false\n" +
                "        },\n" +
                "        {\n" +
                "            \"key\":\"pointDeduct\",\n" +
                "            \"showName\":\"积分抵扣\",\n" +
                "            \"operation\":false,\n" +
                "            \"value\":2,\n" +
                "            \"mark\":true,\n" +
                "            \"deductType\":1,\n" +
                "            \"showRmbMark\":true,\n" +
                "            \"highLight\":false\n" +
                "        }\n" +
                "    ],\n" +
                "    \"productInfos\":[\n" +
                "        {\n" +
                "            \"pid\":\"001476916785\",\n" +
                "            \"productType\":43505075,\n" +
                "            \"productItems\":[\n" +
                "                {\n" +
                "                    \"picUrl\":\"https://f-flight-akihabaracp.qunarzz.com/f_flight_akihabara_f_flight_akihabara/bfhW4h7diPf1BuSandXN.jpg\",\n" +
                "                    \"name\":\"电动双面清洁洗脸仪 浅蓝 VC19402G044BU101\",\n" +
                "                    \"productDesc\":\"男女超声波去黑头神器\",\n" +
                "                    \"buyNum\":1,\n" +
                "                    \"productPrice\":35.9,\n" +
                "                    \"depTrip\":null,\n" +
                "                    \"returnTip\":null,\n" +
                "                    \"relateName\":\"浅蓝（带底座）\",\n" +
                "                    \"bookingProductText\":\"安心购1\",\n" +
                "                    \"pointShowStyle\":1,\n" +
                "                    \"pointDeduct\":2,\n" +
                "                    \"pointPrice\":33.9,\n" +
                "                    \"pointPriceDeductPoint\":20,\n" +
                "                    \"receiveAddressBlackList\":\"\",\n" +
                "                    \"isShowPrice\":true\n" +
                "                }\n" +
                "            ],\n" +
                "            \"buyNum\":1\n" +
                "        },\n" +
                "        {\n" +
                "            \"pid\":\"000726682281\",\n" +
                "            \"productType\":43505075,\n" +
                "            \"productItems\":[\n" +
                "                {\n" +
                "                    \"picUrl\":\"https://f-flight-akihabaracp.qunarzz.com/f_flight_akihabara_f_flight_akihabara/4RT8j1lqCkpaxEr2mT5r.jpg\",\n" +
                "                    \"name\":\"上新了故宫 紫禁城3D立体拼图太和殿【淘宝价格78，限时优惠价59】\",\n" +
                "                    \"productDesc\":\"淘宝78元，限时优惠价59元\",\n" +
                "                    \"buyNum\":1,\n" +
                "                    \"productPrice\":59,\n" +
                "                    \"depTrip\":null,\n" +
                "                    \"returnTip\":null,\n" +
                "                    \"relateName\":\"太和殿\",\n" +
                "                    \"bookingProductText\":\"安心购1\",\n" +
                "                    \"pointShowStyle\":0,\n" +
                "                    \"pointDeduct\":null,\n" +
                "                    \"pointPrice\":null,\n" +
                "                    \"pointPriceDeductPoint\":null,\n" +
                "                    \"receiveAddressBlackList\":\"\",\n" +
                "                    \"isShowPrice\":true\n" +
                "                }\n" +
                "            ],\n" +
                "            \"buyNum\":1\n" +
                "        }\n" +
                "    ],\n" +
                "    \"originPrice\":null,\n" +
                "    \"memberDiscount\":0,\n" +
                "    \"packageDiscount\":0,\n" +
                "    \"baseDeductInfoContext\":null,\n" +
                "    \"serviceTitle\":null,\n" +
                "    \"serviceAddress\":null,\n" +
                "    \"receivedMask\":null,\n" +
                "    \"ownerPanelInfo\":null,\n" +
                "    \"seatInfo\":null,\n" +
                "    \"daMaiToken\":null,\n" +
                "    \"package\":false,\n" +
                "    \"rechargeProductType\":false,\n" +
                "    \"combine\":true,\n" +
                "    \"needRealNameAuth\":false,\n" +
                "    \"restrainPersionalUse\":false\n" +
                "}";
        String resultStr = new CompareJson("copyId").compareJson(json1, json2);
        System.out.println(resultStr);
    }

    private void compareJson(JSONObject jsonObject1, JSONObject jsonObject2, Map<String, Object> objectMap) {
        Iterator<String> iterator = jsonObject1.keySet().iterator();
        while (iterator.hasNext()) {
            String key = iterator.next();
            if (ignoreKeys.contains(key)) {
                continue;
            }

            Object value1 = jsonObject1.get(key);
            Object value2 = jsonObject2.get(key);
            compareJson(key, value1, value2, objectMap);
        }
    }

    private void compareJson(JSONArray jsonArray1, JSONArray jsonArray2, List<Map<String, Object>> arrayMap) {

        JSONArray jsonArray = (JSONArray) jsonArray1.clone();
        if (jsonArray2 != null) {
            jsonArray.addAll(jsonArray2);
        }

        for (int i = 0; i < jsonArray.size(); i++) {

            JSONObject jsonObject = (JSONObject) jsonArray.get(i);
            Object keyValue = jsonObject.get(this.itemKey);
            if (keyValue == null) {
                continue;
            }

            JSONObject jsonObject1 = null;
            for (int j = 0; j < jsonArray1.size(); j++) {
                JSONObject jsonObj = (JSONObject) jsonArray1.get(j);
                if (keyValue.equals(jsonObj.get(this.itemKey))) {
                    jsonObject1 = jsonObj;
                    break;
                }
            }

            JSONObject jsonObject2 = null;
            for (int j = 0; j < jsonArray2.size(); j++) {
                JSONObject jsonObj = (JSONObject) jsonArray2.get(j);
                if (keyValue.equals(jsonObj.get(this.itemKey))) {
                    jsonObject2 = jsonObj;
                    break;
                }
            }

            Map<String, Object> objectMap = new HashMap<>();
            if (jsonObject1 != null && jsonObject2 == null) {
                objectMap.put(this.itemKey, keyValue);
                objectMap.put(SysType, TypeNew);
                objectMap.put(SysObj, jsonObject1);
            } else if (jsonObject1 == null && jsonObject2 != null) {
                objectMap.put(this.itemKey, keyValue);
                objectMap.put(SysType, TypeDelete);
                objectMap.put(SysObj, jsonObject2);
            } else {
                Map<String, Object> differenceMap = new HashMap<>();
                compareJson(jsonObject1, jsonObject2, differenceMap);
                if (differenceMap.size() > 0) {
                    objectMap.put(this.itemKey, keyValue);
                    objectMap.put(SysType, TypeDifference);
                    objectMap.put(SysObj, differenceMap);
                }
            }

            if (objectMap.size() > 0) {

                Map<String, Object> findMap = null;
                for (Map<String, Object> map : arrayMap) {
                    if (keyValue.equals(map.get(this.itemKey))) {
                        findMap = map;
                        break;
                    }
                }

                if (findMap == null) {
                    arrayMap.add(objectMap);
                }
            }
        }
    }

    private void compareJson(String key, Object json1, Object json2, Map<String, Object> resultMap) {
        if (json1 instanceof JSONObject) {

            Map<String, Object> objectMap = new HashMap<>();
            compareJson((JSONObject) json1, (JSONObject) json2, objectMap);
            if (objectMap.size() > 0) {
                resultMap.put(key, objectMap);
            }

        } else if (json1 instanceof JSONArray) {

            JSONArray jsonArray = (JSONArray) json1;
            if (jsonArray != null && jsonArray.size() > 0) {
                for (int i = 0; i < jsonArray.size(); i++) {
                    if (!(jsonArray.get(i) instanceof JSONObject)) { //["1","2"],[1,2]...
                        Map<String, Object> compareMap = new HashMap<>();
                        compareMap.put(SysNew, json1);
                        compareMap.put(SysOld, json2);
                        resultMap.put(key, compareMap);
                        return;
                    }
                }
            }

            List<Map<String, Object>> arrayMap = new ArrayList<>();
            compareJson((JSONArray) json1, (JSONArray) json2, arrayMap);
            if (arrayMap.size() > 0) {
                resultMap.put(key, arrayMap);
            }

        } else if ((json1 == null && json2 != null) || (json1 != null && !json1.equals(json2))) {
            Map<String, Object> compareMap = new HashMap<>();
            compareMap.put(SysNew, json1);
            compareMap.put(SysOld, json2);
            resultMap.put(key, compareMap);
        }
    }

    public String compareJson(String json1, String json2) {
        Object jsonObj1 = JSONObject.parse(json1);
        Object jsonObj2 = JSONObject.parse(json2);
        Map<String, Object> resultMap = new HashMap<>();
        compareJson(SysRoot, jsonObj1, jsonObj2, resultMap);
        String resultStr = JSON.toJSONString(resultMap.get(SysRoot), new SerializerFeature[]{SerializerFeature.WriteMapNullValue});
        return resultStr;
    }
}